package com.felight.sensor;

import java.util.List;

import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.util.Log;
import android.view.Menu;
import android.widget.TextView;

public class MainActivity extends Activity implements SensorEventListener {

	SensorManager mSensorManager;
	TextView tvSensorList;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        tvSensorList=(TextView)findViewById(R.id.tvResultSensor);
        mSensorManager=(SensorManager)getSystemService(Context.SENSOR_SERVICE);
        List<Sensor>  sensorList= mSensorManager.getSensorList(Sensor.TYPE_ALL);
              
      for(int i=1;i<sensorList.size();i++)
      {
    	  tvSensorList.append("\n"+sensorList.get(i).getName().contains("Google Inc."));
      }
      /*  List<Sensor> proXIMITY=mSensorManager.getSensorList(Sensor.TYPE_ALL);
       for(int i=1;i<proXIMITY.size();i++)
       {
        	tvSensorList.append("\n"+proXIMITY.get(i).getVendor()+
        			             "\n"+proXIMITY.get(i).getVersion()+
        			             "\n"+proXIMITY.get(i).getName()+
        			             "\n"+proXIMITY.get(i).getMaximumRange()+
        			             "\n"+proXIMITY.get(i).getPower());
       }
       Sensor prxmty= mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY);
     tvSensorList.append(prxmty.getName()+"\n"+prxmty.getVendor());
      */  
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }

	public void onSensorChanged(SensorEvent event) {
		// TODO Auto-generated method stub
		
	}

	public void onAccuracyChanged(Sensor sensor, int accuracy) {
		// TODO Auto-generated method stub
		
	}
	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
	
	}
	
	@Override
	protected void onPause() {
		// TODO Auto-generated method stub
		super.onPause();
	
	}
}
